/**
 * Created by shadow on 2017/10/19.
 */
var treeData = [{
    text: "流程管理",
    children: [{
        text: "流程定义部署",
        attributes: {
            url: '<iframe width="100%" height="100%" frameborder="0"  src="' + basePath + '/flow/flow-defination" style="width:100%;height:100%;margin:0px 0px;"></iframe>'
        }
    },
        {
            text: "运行中流程",
            attributes: {
                url: '<iframe width="100%" height="100%" frameborder="0"  src="' + basePath + '/flow/flow-running" style="width:100%;height:100%;margin:0px 0px;"></iframe>'
            }
        }, {
            text: "已结束流程",
            attributes: {
                url: '<iframe width="100%" height="100%" frameborder="0"  src="' + basePath + '/flow/flow-finished" style="width:100%;height:100%;margin:0px 0px;"></iframe>'
            }
        }
    ]
}];

$(function () {
    //实例化树形菜单
    $("#tree").tree({
        data: treeData,
        lines: true,
        onClick: function (node) {
            if (node.attributes) {
                Open(node.text, node.attributes.url);
            }
        }
    });
    //在右边center区域打开菜单，新增tab
    function Open(text, url) {
        if ($("#mainTab").tabs('exists', text)) {
            $('#mainTab').tabs('select', text);
        } else {
            $('#mainTab').tabs('add', {
                title: text,
                closable: true,
                content: url
            });
        }
    }


});